|
|
|
|
|
|
|
other nearby objects. If a large, dark object lies near a second object, the first may block some of the ambient light that would otherwise reach the second. A large bright object may reflect extra light onto other nearby objects. |
|
|
|
|
|
|
|
|
In using Cosn(f) to model specular reflection, the lighting model equation makes a similar assumption. The model assumes that light reflected from a shiny surface does not increase the light falling on nearby objects. This means nearby objects are darker than they should be. It also means you are unable to see the reflection of one object in another. Reflection in this model applies only to light coming from the light source directly to an object and then reflecting toward the viewpoint. Chapter 17, Ray Tracing, describes a more general reflection model that allows you to see the reflection of one object in another. |
|
|
|
|
|
|
|
|
Many programs use polygons to simulate a smooth surface. You can use a few techniques to smooth out the edges between the polygons when you shade them. The two most common techniques are Gouraud shading and Phong shading. Unfortunately, both methods are slow and difficult in Visual Basic, so they are only briefly described here. Smooth shading is accomplished in a different way by the ray tracing algorithm described in Chapter 17. |
|
|
|
|
|
|
|
|
In Gouraud shading, or intensity interpolation shading, you begin by creating surface normal vectors at each vertex of each polygon. In some cases, you can compute these |
|
|
|
|
|
|
|
|
Figure 16.10
Program Light4 displaying a sphere with specular constant n = 10. |
|
|
|
|
|